package com.ecommerce.dal.entity;
// Generated May 3, 2013 3:35:49 PM by Hibernate Tools 3.6.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Customer generated by hbm2java
 */
@Entity
@Table(name = "customer")
@PrimaryKeyJoinColumn(name="CUSTOMER_ID")
public class Customer extends User implements java.io.Serializable {

	private long customerId;
	private User user;
	private boolean verified;
	private Set<CustomerItem> customerItems = new HashSet<CustomerItem>(0);

	public Customer() {
	}

	public Customer(User user, boolean verified) {
		this.user = user;
		this.verified = verified;
	}

	public Customer(User user, boolean verified, Set<CustomerItem> customerItems) {
		this.user = user;
		this.verified = verified;
		this.customerItems = customerItems;
	}

//	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "user"))
//	@Id
//	@GeneratedValue(generator = "generator")
//	@Column(name = "CUSTOMER_ID", unique = true, nullable = false)
//	public long getCustomerId() {
//		return this.customerId;
//	}
//
//	public void setCustomerId(long customerId) {
//		this.customerId = customerId;
//	}

	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "VERIFIED", nullable = false)
	public boolean isVerified() {
		return this.verified;
	}

	public void setVerified(boolean verified) {
		this.verified = verified;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "customer")
	public Set<CustomerItem> getCustomerItems() {
		return this.customerItems;
	}

	public void setCustomerItems(Set<CustomerItem> customerItems) {
		this.customerItems = customerItems;
	}

}
